package com.yonyou.pmclouds.repeatwork.process;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.yonyou.pmclouds.basecom.bp.processor.SingleProcessor;
import com.yonyou.pmclouds.basecom.exception.BusinessException;
import com.yonyou.pmclouds.copyperson.entity.CopyPersonVO;
import com.yonyou.pmclouds.copyperson.rmiitf.ICopyPersonMaintain;
import com.yonyou.pmclouds.repeatwork.entity.RepeatWorkVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 抄送人批量保存
 */
@Component
public class RepeatWorkCopyPersonInsertBatchProcessor implements SingleProcessor<RepeatWorkVO> {

    @Autowired
    private ICopyPersonMaintain copyPersonMaintain;

    @Override
    public void process(RepeatWorkVO vo, RepeatWorkVO orig) throws BusinessException {
        List<CopyPersonVO> copyPersonVOList = vo.getCopyPersons();
        if(null != copyPersonVOList && copyPersonVOList.size() > 0){
            copyPersonMaintain.insertBatch(vo.getCopyPersons());
        }
    }
}
